package com.codejiwei.flink.table;

import org.apache.flink.streaming.api.CheckpointingMode;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

import java.time.Duration;

import static java.time.temporal.ChronoUnit.SECONDS;

/**
 * author: codejiwei
 * date: 2023/8/8
 * desc: flink table api with configuration
 **/
public class Flink_Table_API_Configuration {
    public static void main(String[] args) {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        //TODO set configuration
        env.setParallelism(2);
        env.setMaxParallelism(6);
//        env.getConfig().addDefaultKryoSerializer();
        env.getCheckpointConfig().setCheckpointingMode(CheckpointingMode.EXACTLY_ONCE);

        StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);

        tEnv.getConfig().setIdleStateRetention(Duration.of(3, SECONDS));
//        DataStreamSource<Row> sourceDS = env.fromElements(
//                Row.of("Tom", 11),
//                Row.of("Jerry", 22),
//                Row.of("Tom", 33)
//        );


    }
}
